home *** CD-ROM | disk | FTP | other *** search
/ Just Call Me Internet / Just Call Me Internet.iso / prog / atari / c / stngpasm / pure_c / include / uran / uran_av.sh < prev    next >
Encoding:
Text File  |  1997-08-08  |  21.0 KB  |  835 lines

  1. ;----------------------------------------------------------------------------
  2. ;File name:    URAn_AV.SH            Revision date:    1997.08.08
  3. ;Creator:    Ulf Ronald Andersson        Creation date:    1991.02.02
  4. ;(c)1991 by:    Ulf Ronald Andersson        All rights reserved
  5. ;Released as:    FREEWARE            (commercial sales forbidden)
  6. ;----------------------------------------------------------------------------
  7. ;File purpose:    Symbol & Macro library for application message protocols
  8. ;
  9. ;    AV - protocol    App - serVer (originally Acc-Venus (Gemini))
  10. ;    MP - protocol    Module player (originally for Paula)
  11. ;
  12. ;----------------------------------------------------------------------------
  13. ;Required header declarations:
  14. ;
  15. ;    .include    "uran\STRUCT.SH"
  16. ;    .include    "uran\URAn_SYS.SH"
  17. ;    .include    "uran\URAn_GEM.SH"
  18. ;    .include    "uran\URAn_AV.SH"
  19. ;
  20. ;copy the above to the header of your program and 'uncomment' the includes
  21. ;----------------------------------------------------------------------------
  22. ;    Library macros:
  23. ;
  24. ;AV_set_partner name_p    d0 = app_id of AV partner or -1 if none available
  25. ;AV_send msg,args...    d0 = 0 normally, but -1 on appl_write failure
  26. ;
  27. ;VA_set_partner name_p    d0 = app_id of VA partner, or -1 if not available
  28. ;VA_send msg,args...    d0 = 0 normally, but -1 on appl_write failure
  29. ;
  30. ;MP_set_partner    name_p    d0 = app_id of MP partner, or -1 if not available
  31. ;MP_send msg,args...    d0 = 0 normally, but -1 on appl_write failure
  32. ;
  33. ;For AV_set_partner and VA_set_partner, a name_p of -1 causes a search for
  34. ;a standard AVSERVER, using four different methods.
  35. ;
  36. ;For MP_set_partner, a name_p of -1 causes a search for
  37. ;a standard MPSERVER, using three different methods.
  38. ;
  39. ;----------------------------------------------------------------------------
  40. ;    Defined variables:
  41. ;
  42. ;AV_sender_id    1 W  = app id of AV sender (set = global[2] by AV_set_partner)
  43. ;AV_partner_id    1 W  = app id of AV partner (filled by AV_set_partner)
  44. ;AV_message    8 W  used by AV_send
  45. ;
  46. ;VA_sender_id    1 W  = app id of VA sender (set = global[2] by VA_set_partner)
  47. ;VA_partner_id    1 W  = app id of VA partner (filled by VA_set_partner)
  48. ;VA_message    8 W  used by VA_send
  49. ;
  50. ;MP_sender_id    1 W  = app id of MP sender (set = global[2] by MP_set_partner)
  51. ;MP_partner_id    1 W  = app id of MP partner (filled by MP_set_partner)
  52. ;MP_message    8 W  used by MP_send
  53. ;
  54. ;----------------------------------------------------------------------------
  55. ;NB: You must include the following line somewhere after the macro calls
  56. ;
  57. ;    "make    AV_links"
  58. ;
  59. ;NB: That will cause the needed routines to be included at that point.
  60. ;NB: You may do this several times (after further calls), and at each
  61. ;NB: point only the 'newly' referenced routines will be added to the code.
  62. ;NB: A dummy reference macro exists, so routines can be added to code even
  63. ;NB: without calling them.  The macro is '_uniref', used as below:
  64. ;
  65. ;    "_uniref AV_set_partner"
  66. ;
  67. ;----------------------------------------------------------------------------
  68. ;    The link macro and associated macro declarations
  69. ;
  70. .MACRO    AV_links
  71.     _unidef    AV_set_partner
  72.     _unidef    AV_send
  73.     _unidef    VA_set_partner
  74.     _unidef    VA_send
  75.     _unidef    MP_send
  76.     GEM_links
  77. .ENDM    AV_links
  78. ;
  79.     _unidec    AV_set_partner
  80.     _unidec    AV_send
  81.     _unidec    VA_set_partner
  82.     _unidec    VA_send
  83.     _unidec    MP_send
  84. ;
  85. ;----------------------------------------------------------------------------
  86. ;    AV_PROTOKOLL flag bits and flag words
  87. ;
  88. ;    message[3]
  89. ;
  90. b_VA_SETSTATUS        equ 0
  91. b_VA_START        equ 1
  92. b_AV_STARTED_A        equ 2
  93. b_VA_FONTCHANGED    equ 3
  94. b_VA_quoting        equ 4
  95. b_VA_PATHUPDATE        equ 5
  96. ;
  97. w_VA_SETSTATUS        equ 1<<0
  98. w_VA_START        equ 1<<1
  99. w_AV_STARTED_A        equ 1<<2
  100. w_VA_FONTCHANGED    equ 1<<3
  101. w_VA_quoting        equ 1<<4
  102. w_VA_PATHUPDATE        equ 1<<5
  103. ;
  104. ;----------------------------------------------------------------------------
  105. ;    AV_PROTOSTATUS flag bits and flag words
  106. ;
  107. ;    message[3]
  108. ;
  109. b_AV_SENDKEY        equ  0
  110. b_AV_ASKFILEFONT    equ  1
  111. b_AV_console        equ  2
  112. b_AV_ASKOBJECT        equ  3
  113. b_AV_OPENWIND        equ  4
  114. b_AV_STARTPROG        equ  5
  115. b_AV_accwind        equ  6
  116. b_AV_status        equ  7
  117. b_AV_COPYDRAGGED    equ  8
  118. b_AV_updwhatdrag    equ  9
  119. b_AV_EXIT        equ 10
  120. b_AV_XWIND        equ 11
  121. b_AV_FONTCHANGED    equ 12
  122. b_AV_STARTED_V        equ 13
  123. b_AV_quoting        equ 14
  124. b_AV_FILEINFO        equ 15
  125. ;
  126. w_AV_SENDKEY        equ  1<<0
  127. w_AV_ASKFILEFONT    equ  1<<1
  128. w_AV_console        equ  1<<2
  129. w_AV_ASKOBJECT        equ  1<<3
  130. w_AV_OPENWIND        equ  1<<4
  131. w_AV_STARTPROG        equ  1<<5
  132. w_AV_accwind        equ  1<<6
  133. w_AV_status        equ  1<<7
  134. w_AV_COPYDRAGGED    equ  1<<8
  135. w_AV_updwhatdrag    equ  1<<9
  136. w_AV_EXIT        equ 1<<10
  137. w_AV_XWIND        equ 1<<11
  138. w_AV_FONTCHANGED    equ 1<<12
  139. w_AV_STARTED_V        equ 1<<13
  140. w_AV_quoting        equ 1<<14
  141. w_AV_FILEINFO        equ 1<<15
  142. ;
  143. ;    message[4]
  144. ;
  145. b_AV_COPYFILE        equ 16
  146. b_AV_DELFILE        equ 17
  147. b_AV_VIEW        equ 18
  148. b_AV_SETWINDPOS        equ 19
  149. ;
  150. w_AV_COPYFILE        equ 1<<16
  151. w_AV_DELFILE        equ 1<<17
  152. w_AV_VIEW        equ 1<<18
  153. w_AV_SETWINDPOS        equ 1<<19
  154. ;
  155. ;----------------------------------------------------------------------------
  156. ;    Message codes
  157. ;
  158. ;------------------------------------
  159. ;    Mandatory
  160. ;
  161. AV_PROTOKOLL        equ $4700    ;(flags, res1, res2, acc_name_p)
  162. __AV_PROTOKOLL        equ $00002603
  163. VA_PROTOSTATUS        equ $4701    ;(flags, res1, res2, acc_name_p)
  164. __VA_PROTOSTATUS    equ $00002603
  165. ;
  166. ;------------------------------------
  167. ;    needs b_AV_EXIT on Venus
  168. ;
  169. AV_EXIT            equ $4736    ;(acc_app_id)
  170. __AV_EXIT        equ $00000003
  171. ;
  172. ;------------------------------------
  173. ;    needs b_AV_SENDKEY on Venus
  174. ;
  175. AV_SENDKEY        equ $4710    ;(kbshift,scan_asc)
  176. __AV_SENDKEY        equ $00000403
  177. ;
  178. ;------------------------------------
  179. ;    needs b_AV_STARTPROG on Venus
  180. ;
  181. AV_STARTPROG        equ $4722    ;(path_fname_p, cmd_line_p, call_shake)
  182. __AV_STARTPROG        equ $00072523
  183. VA_PROGSTART        equ $4723    ;(start_f, ret_code, dummy1, dummy2, call_shake)
  184. __VA_PROGSTART        equ $00070403
  185. ;
  186. ;------------------------------------
  187. ;    needs b_VA_START in Acc
  188. ;
  189. VA_START        equ $4711    ;(cmd_line_p)  cmd_line_p may be NULL
  190. __VA_START        equ $00000023
  191. ;
  192. ;------------------------------------
  193. ;    needs both b_AV_STARTED_V on venus, and b_AV_STARTED_A in Acc
  194. ;
  195. AV_STARTED        equ $4738    ;(cmd_line_p)  cmd_line_p identical to that in VA_START
  196. __AV_STARTED        equ $00000023
  197. ;
  198. ;------------------------------------
  199. ;    needs b_AV_accwind on Venus
  200. ;
  201. AV_ACCWINDOPEN        equ $4724    ;(wind_h)
  202. __AV_ACCWINDOPEN    equ $00000003
  203. VA_DRAGACCWIND        equ $4725    ;(wind_h, x, y, cmd_line_p)
  204. __VA_DRAGACCWIND    equ $26050403
  205. AV_ACCWINDCLOSED    equ $4726    ;(wind_h)
  206. __AV_ACCWINDCLOSED    equ $00000003
  207. ;
  208. ;------------------------------------
  209. ;    needs b_AV_COPYDRAGGED on Venus
  210. ;
  211. AV_COPYDRAGGED        equ $4728    ;(kbshift, destpath_p)
  212. __AV_COPYDRAGGED    equ $00002403
  213. VA_COPYCOMPLETE        equ $4729    ;(change_f)
  214. __VA_COPYCOMPLETE    equ $00000003
  215. ;
  216. ;------------------------------------
  217. ;    needs b_AV_ASKFILEFONT on Venus
  218. ;
  219. AV_ASKFILEFONT        equ $4712    ;()
  220. __AV_ASKFILEFONT    equ $00000000
  221. VA_FILEFONT        equ $4713    ;(font_id, font_points)
  222. __VA_FILEFONT        equ $00000403
  223. ;
  224. ;------------------------------------
  225. ;    needs b_AV_OPENWIND on Venus
  226. ;
  227. AV_OPENWIND        equ $4720    ;(windpath_p, wildcard_p)
  228. __AV_OPENWIND        equ $00002523
  229. VA_WINDOPEN        equ $4721    ;(opened_f)
  230. __VA_WINDOPEN        equ $00000003
  231. ;
  232. ;------------------------------------
  233. ;    needs b_AV_XWIND on Venus
  234. ;
  235. AV_XWIND        equ $4740    ;(windpath_p, wildcard_p, x_f)
  236. __AV_XWIND        equ $00072523
  237. VA_XOPEN        equ $4741    ;(opened_f)
  238. __VA_XOPEN        equ $00000003
  239. ;
  240. ;------------------------------------
  241. ;    needs b_AV_ASKOBJECT on Venus
  242. ;
  243. AV_ASKOBJECT        equ $4716    ;()
  244. __AV_ASKOBJECT        equ $00000000
  245. VA_OBJECT        equ $4717    ;(->cmd_line_p)
  246. __VA_OBJECT        equ $00000023
  247. ;
  248. ;------------------------------------
  249. ;    needs b_AV_updwhatdrag on Venus
  250. ;
  251. AV_WHATIZIT        equ $4732    ;(X, Y)
  252. __AV_WHATIZIT        equ $00000403
  253. VA_THATIZIT        equ $4733    ;(owner_id, type, obj_name_p)
  254. __VA_THATIZIT        equ $00250403
  255. AV_PATHUPDATE        equ $4730    ;(updpath_p) NB: asolute path!
  256. __AV_PATHUPDATE        equ $00000023
  257. AV_DRAGONWINDOW        equ $4734    ;(x,y,kbshift,cmd_line_p)
  258. __AV_DRAGONWINDOW    equ $26050403
  259. VA_DRAGCOMPLETE        equ $4735    ;(change_f)
  260. __VA_DRAGCOMPLETE    equ $00000003
  261. VA_FONTCHANGED        equ $4739    ;(filefont_id,filefont_pts,con_font_id,con_font_pts)
  262. __VA_FONTCHANGED    equ $06050403
  263. ;
  264. ;------------------------------------
  265. ;    needs b_AV_console on Venus
  266. ;
  267. AV_OPENCONSOLE        equ $4718    ;()
  268. __AV_OPENCONSOLE    equ $00000000
  269. VA_CONSOLEOPEN        equ $4719    ;(opened_f)
  270. __VA_CONSOLEOPEN    equ $00000003
  271. AV_ASKCONFONT        equ $4714    ;()
  272. __AV_ASKCONFONT        equ $00000000
  273. VA_CONFONT        equ $4715    ;(font_id,font_pts)
  274. __VA_CONFONT        equ $00000403
  275. ;
  276. ;------------------------------------
  277. ;    needs b_AV_status on Venus
  278. ;
  279. AV_GETSTATUS        equ $4703    ;()
  280. __AV_GETSTATUS        equ $00000000
  281. AV_STATUS        equ $4704    ;(status_s_p)
  282. __AV_STATUS        equ $00000023
  283. ;
  284. ;------------------------------------
  285. ;    needs b_VA_SETSTATUS in Acc
  286. ;
  287. VA_SETSTATUS        equ $4705    ;(status_s_p)
  288. __VA_SETSTATUS        equ $00000023
  289. ;
  290. ;----------------------------------------------------------------------------
  291. ;    need THING (or other server made late 1995 or later)
  292. ;
  293. AV_VIEW            equ $4751    ;(pathfname_p)
  294. __AV_VIEW        equ $00000023
  295. AV_VIEWED        equ $4752    ;(OK_f)
  296. __AV_VIEWED        equ $00000003
  297. AV_FILEINFO        equ $4753    ;(cmd_line_p)
  298. __AV_FILEINFO        equ $00000023
  299. VA_FILECHANGED        equ $4754    ;(cmd_line_p) same as in AV_FILEINFO, but names may have changed
  300. __VA_FILECHANGED    equ $00000023
  301. AV_COPYFILE        equ $4755    ;(cmd_line_p, destpath_p, opmode_f) b0=move b1=rename b2=overwrite
  302. __AV_COPYFILE        equ $00072523
  303. VA_FILECOPIED        equ $4756    ;(OK_f)
  304. __VA_FILECOPIED        equ $00000003
  305. AV_DELFILE        equ $4757    ;(cmd_line_p)
  306. __AV_DELFILE        equ $00000023
  307. VA_FILEDELETED        equ $4758    ;(OK_f)
  308. __VA_FILEDELETED    equ $00000003
  309. AV_SETWINDPOS        equ $4759    ;(x,y,w,h)
  310. __AV_SETWINDPOS        equ $06050403
  311. VA_PATHUPDATE        equ $4760    ;(changed_path_p)  NB: assume subfolders need rereading
  312. __VA_PATHUPDATE        equ $00000023
  313. ;
  314. ;
  315. ;    MP-protocol messages
  316. ;
  317. MP_ACK            equ $4800        ;Paula says OK to last command
  318. __MP_ACK        equ $00000000
  319. MP_NAK            equ $4801        ;Paula says NO to last command
  320. __MP_NAK        equ $00000000
  321. ;The two above have msg[7] = Paula version : V2.4 => $0204
  322. ;
  323. MP_START        equ $4802        ;Arguments like VA_START => reply ACK/NAK
  324. __MP_START        equ $00000023
  325. ;Reply ACK means the command string may be reused
  326. ;
  327. ;The two below release module RAM
  328. MP_STOP            equ $4803        ;=> reply ACK
  329. __MP_STOP        equ $00000000
  330. MP_SHUTDOWN        equ $4804        ;=> reply ACK
  331. __MP_SHUTDOWN        equ $00000000
  332. ;
  333. ;----------------------------------------------------------------------------
  334. ;Start of:    Macro definitions
  335. ;----------------------------------------------------------------------------
  336. ;int16    AV_set_partner(char *name);
  337. ;
  338. .MACRO    AV_set_partner.mode    name
  339.     _uniref        AV_set_partner
  340.     PUREC_func.mode    AV_set_partner,1,3,name
  341. .ENDM    AV_set_partner
  342. ;
  343. .MACRO    code_AV_set_partner
  344.     movem.l        d1-d2/a0-a2,-(sp)
  345.     move        global+4,AV_sender_id
  346.     move.l        a0,addrin            ;check for special app name
  347.     bmi.s        .seek_partner
  348.     sub_aes        #appl_find
  349.     move        intout,AV_partner_id
  350.     bra        .done
  351. ;
  352. .seek_partner:
  353.     move.l        #.pad8_AVSERVER_s,addrin    ;check for app named "AVSERVER"
  354.     sub_aes        #appl_find
  355.     move        intout,AV_partner_id
  356.     bpl        .done
  357.     move.l        #.AVSERVER_eq_s,addrin+4    ;check environment for 'AVSERVER='
  358.     move.l        #.AVSERVER_name_p,addrin
  359.     sub_aes        #shel_envrn
  360.     move        #-1,AV_partner_id
  361.     tst        intout
  362.     beq.s        .not_env_partner
  363.     lea        .AVSERVER_name_s,a1
  364.     move.l        .AVSERVER_name_p,a0
  365.     moveq        #' ',d1
  366.     moveq        #8-1,d2
  367. .pad_8_loop:
  368.     move.b        (a0)+,(a1)+
  369.     bne.s        .next_char
  370.     subq        #1,a0
  371.     move.b        d1,-1(a1)
  372. .next_char:
  373.     dbra        d2,.pad_8_loop
  374.     move.l        #.AVSERVER_name_s,addrin
  375.     sub_aes        #appl_find
  376.     move        intout,AV_partner_id
  377.     bpl.s        .done
  378. .not_env_partner:
  379.     move.l        #.pad8_THING_s,addrin        ;check for app named "THING  "
  380.     sub_aes        #appl_find
  381.     move        intout,AV_partner_id
  382.     bpl.s        .done
  383.     move.l        #.pad8_GEMINI_s,addrin        ;check for app named "GEMINI  "
  384.     sub_aes        #appl_find
  385.     move        intout,AV_partner_id
  386. .done:
  387.     movem.l        (sp)+,d1-d2/a0-a2
  388.     move        AV_partner_id,d0        ;d0 = app_id of AVSERVER or -1  (flagged)
  389.     rts
  390. ;
  391. .pad8_THING_s:
  392.     dc.b        'THING   ',NUL
  393. .pad8_GEMINI_s:
  394.     dc.b        'GEMINI  ',NUL
  395. .pad8_AVSERVER_s:
  396.     dc.b        'AVSERVER',NUL
  397. .AVSERVER_eq_s:
  398.     dc.b        'AVSERVER=',NUL
  399. .AVSERVER_name_s:
  400.     ds.b        9
  401.     even
  402. .AVSERVER_name_p:
  403.     dc.l        0
  404. .ENDM    code_AV_set_partner
  405. ;
  406. ;------------------------------------
  407. ;
  408. .MACRO    AV_send.mode    AV_msg,arg1,arg2,arg3,arg4,arg5
  409.     _uniref        AV_send
  410. __AV_flag        =    __AV_&AV_msg
  411.     .IFB        AV_msg
  412.     .ERROR        AV_send used without any message code
  413.     .EXITM
  414.     .ENDIF
  415.     .IFNB        arg5
  416.     .ERROR        "AV_send used with more than 5 arguments"
  417.     .ERROR        "acceptable args = '&AV_msg,&arg1,&arg2,&arg3,&arg4'"
  418.     .ERROR        "incorrect arg = 'arg 5'"
  419.     .ENDIF
  420.     jsr        AV_preclear
  421.     move        #(AV_&AV_msg)&$FFFF,AV_message
  422.     .IFNB        arg1
  423.     __AV_arg.mode    0,arg1
  424.     .IFNB        arg2
  425.     __AV_arg.mode    1,arg2
  426.     .IFNB        arg3
  427.     __AV_arg.mode    2,arg3
  428.     .IFNB        arg4
  429.     __AV_arg.mode    3,arg4
  430.     .ENDIF        arg4
  431.     .ENDIF        arg3
  432.     .ENDIF        arg2
  433.     .ENDIF        arg1
  434.     jsr        code_AV_send
  435. .ENDM    AV_send
  436. ;
  437. .MACRO    code_AV_send
  438.     movem.l        d1-d2/a0-a2,-(sp)
  439.     move        AV_partner_id(pc),d0
  440.     bpl.s        .send_it_1
  441.     AV_set_partner    -1.w
  442.     bmi.s        .error
  443. .send_it_1:
  444.     move        AV_sender_id(pc),d0
  445.     bpl.s        .send_it_2
  446.     move        global+4,AV_sender_id
  447. .send_it_2:
  448.     lea        AV_message(pc),a0
  449.     clr        4(a0)
  450.     move        AV_sender_id(pc),2(a0)
  451.     gem_aes        appl_write,AV_partner_id(pc),#16,AV_message(pc)
  452.     moveq        #E_ACCDN,d0
  453.     tst        intout
  454.     beq.s        .exit
  455.     clr.l        d0
  456. .exit:
  457.     movem.l        (sp)+,d1-d2/a0-a2
  458.     tst        d0
  459.     rts
  460. ;
  461. .error:
  462.     moveq        #E_INVFN,d0
  463.     bra.s        .exit
  464. ;
  465. AV_preclear:
  466.     clr.l        AV_message
  467.     clr.l        AV_message+4
  468.     clr.l        AV_message+8
  469.     clr.l        AV_message+12
  470.     rts
  471. ;
  472. AV_message:
  473.     ds.w        8
  474. AV_sender_id:
  475.     dc.w        -1
  476. AV_partner_id:
  477.     dc.w        -1
  478. .ENDM    code_AV_send
  479. ;
  480. ;------------------------------------
  481. ;
  482. .MACRO    VA_set_partner.mode    name
  483.     _uniref        VA_set_partner
  484.     PUREC_func.mode    VA_set_partner,1,3,name
  485. .ENDM    VA_set_partner
  486. ;
  487. .MACRO    code_VA_set_partner
  488.     movem.l        d1-d2/a0-a2,-(sp)
  489.     move        global+4,VA_sender_id
  490.     move.l        d0,addrin
  491.     bmi.s        .seek_partner
  492.     sub_aes        #appl_find
  493.     move        intout,VA_partner_id
  494.     bra        .done
  495. ;
  496. .seek_partner:
  497.     move.l        #.pad8_AVSERVER_s,addrin    ;check for app named "AVSERVER"
  498.     sub_aes        #appl_find
  499.     move        intout,VA_partner_id
  500.     bpl        .done
  501.     move.l        #.AVSERVER_eq_s,addrin+4    ;check environment for 'AVSERVER='
  502.     move.l        #.AVSERVER_name_p,addrin
  503.     sub_aes        #shel_envrn
  504.     move        #-1,VA_partner_id
  505.     tst        intout
  506.     beq.s        .not_env_partner
  507.     lea        .AVSERVER_name_s,a1
  508.     move.l        .AVSERVER_name_p,a0
  509.     moveq        #' ',d1
  510.     moveq        #8-1,d2
  511. .pad_8_loop:
  512.     move.b        (a0)+,(a1)+
  513.     bne.s        .next_char
  514.     subq        #1,a0
  515.     move.b        d1,-1(a1)
  516. .next_char:
  517.     dbra        d2,.pad_8_loop
  518.     move.l        #.AVSERVER_name_s,addrin
  519.     sub_aes        #appl_find
  520.     move        intout,VA_partner_id
  521.     bpl.s        .done
  522. .not_env_partner:
  523.     move.l        #.pad8_THING_s,addrin        ;check for app named "THING  "
  524.     sub_aes        #appl_find
  525.     move        intout,VA_partner_id
  526.     bpl.s        .done
  527.     move.l        #.pad8_GEMINI_s,addrin        ;check for app named "GEMINI  "
  528.     sub_aes        #appl_find
  529.     move        intout,VA_partner_id
  530. .done:
  531.     movem.l        (sp)+,d1-d2/a0-a2
  532.     move        VA_partner_id,d0        ;d0 = app_id of VA partner or -1  (flagged)
  533.     rts
  534. ;
  535. .pad8_THING_s:
  536.     dc.b        'THING   ',NUL
  537. .pad8_GEMINI_s:
  538.     dc.b        'GEMINI  ',NUL
  539. .pad8_AVSERVER_s:
  540.     dc.b        'AVSERVER',NUL
  541. .AVSERVER_eq_s:
  542.     dc.b        'AVSERVER=',NUL
  543. .AVSERVER_name_s:
  544.     ds.b        9
  545.     even
  546. .AVSERVER_name_p:
  547.     dc.l        0
  548. .ENDM    VA_set_partner_code
  549. ;
  550. ;------------------------------------
  551. ;
  552. .MACRO    VA_send.mode    VA_msg,arg1,arg2,arg3,arg4
  553.     _uniref        VA_send
  554. __VA_flag        =    __VA_&VA_msg
  555.     .IFB        VA_msg
  556.     .ERROR        VA_send used without any message code
  557.     .EXITM
  558.     .ENDIF
  559.     .IFNB        arg5
  560.     .ERROR        "VA_send used with more than 5 arguments"
  561.     .ERROR        "acceptable args = '&VA_msg,&arg1,&arg2,&arg3,&arg4'"
  562.     .ERROR        "incorrect arg = 'arg 5'"
  563.     .ENDIF
  564.     jsr        VA_preclear
  565.     move        #(VA_&VA_msg)&$FFFF,VA_message
  566.     .IFNB        arg1
  567.     __VA_arg.mode    0,arg1
  568.     .IFNB        arg2
  569.     __VA_arg.mode    1,arg2
  570.     .IFNB        arg3
  571.     __VA_arg.mode    2,arg3
  572.     .IFNB        arg4
  573.     __VA_arg.mode    3,arg4
  574.     .ENDIF        arg4
  575.     .ENDIF        arg3
  576.     .ENDIF        arg2
  577.     .ENDIF        arg1
  578.     jsr        code_VA_send
  579. .ENDM    VA_send
  580. ;
  581. .MACRO    code_VA_send
  582.     movem.l        d1-d2/a0-a2,-(sp)
  583.     move        VA_partner_id(pc),d0
  584.     bpl.s        .send_it_1
  585.     VA_set_partner    -1.w
  586.     bmi.s        .error
  587. .send_it_1:
  588.     move        VA_sender_id(pc),d0
  589.     bpl.s        .send_it_2
  590.     move        global+4,VA_sender_id
  591. .send_it_2:
  592.     lea        VA_message(pc),a0
  593.     clr        4(a0)
  594.     move        VA_sender_id(pc),2(a0)
  595.     GEM_AES        appl_write,VA_partner_id,#16,VA_message(pc)
  596.     moveq        #E_ACCDN,d0
  597.     tst        intout
  598.     beq.s        .exit
  599.     clr.l        d0
  600. .exit:
  601.     movem.l        (sp)+,d1-d2/a0-a2
  602.     tst        d0
  603.     rts
  604. ;
  605. .error:
  606.     moveq        #E_INVFN,d0
  607.     bra.s        .exit
  608. ;
  609. VA_preclear:
  610.     clr.l        VA_message
  611.     clr.l        VA_message+4
  612.     clr.l        VA_message+8
  613.     clr.l        VA_message+12
  614.     rts
  615. ;
  616. VA_message:
  617.     ds.w        8
  618. VA_sender_id:
  619.     dc.w        -1
  620. VA_partner_id:
  621.     dc.w        -1
  622. .ENDM    code_VA_send
  623. ;
  624. ;------------------------------------
  625. ;
  626. .MACRO    __AV_arg.mode    argnum,argval
  627. __AV_type        set    (__AV_flag>>(8*argnum+4)) & 3
  628. __AV_pos        set    ((__AV_flag>>(8*argnum)) & 7)*2
  629.     .IF        (__AV_type==0)
  630.     move        argval,AV_message+__AV_pos
  631.     .EXITM
  632.     .ENDIF        type==0
  633.     .IF        (__AV_type==1)
  634.     move.l        argval,AV_message+__AV_pos
  635.     .EXITM
  636.     .ENDIF        type==1
  637.     .IF        (__AV_type==2)
  638.     .IF        '&.mode'=='.i'
  639.     move.l        argval,AV_message+__AV_pos
  640.     .ELSE
  641.     pea        argval
  642.     move.l        (sp)+,AV_message+__AV_pos
  643.     .ENDIF        mode
  644.     .ENDIF        type==2
  645. .ENDM    __AV_arg
  646. ;
  647. ;------------------------------------
  648. ;
  649. .MACRO    __VA_arg.mode    argnum,argval
  650. __VA_type        set    (__VA_flag>>(8*argnum+4)) & 3
  651. __VA_pos        set    ((__VA_flag>>(8*argnum)) & 7)*2
  652.     .IF        (__VA_type==0)
  653.     move        argval,VA_message+__VA_pos
  654.     .EXITM
  655.     .ENDIF        type==0
  656.     .IF        (__VA_type==1)
  657.     move.l        argval,VA_message+__VA_pos
  658.     .EXITM
  659.     .ENDIF        type==1
  660.     .IF        (__VA_type==2)
  661.     .IF        '&.mode'=='.i'
  662.     move.l        argval,VA_message+__VA_pos
  663.     .ELSE
  664.     pea        argval
  665.     move.l        (sp)+,VA_message+__VA_pos
  666.     .ENDIF        mode
  667.     .ENDIF        type==2
  668. .ENDM    __VA_arg
  669. ;
  670. ;------------------------------------
  671. ;
  672. .MACRO    MP_set_partner.mode    name
  673.     _uniref        MP_set_partner
  674.     PUREC_func.mode    MP_set_partner,1,3,name
  675. .ENDM    MP_set_partner
  676. ;
  677. .MACRO    code_MP_set_partner
  678.     movem.l        d1-d2/a0-a2,-(sp)
  679.     move        global+4,MP_sender_id
  680.     move.l        d0,addrin
  681.     bmi.s        .seek_partner
  682.     sub_aes        #appl_find
  683.     move        intout,MP_partner_id
  684.     bra        .done
  685. ;
  686. .seek_partner:
  687.     move.l        #.pad8_MPSERVER_s,addrin    ;check for app named "MPSERVER"
  688.     sub_aes        #appl_find
  689.     move        intout,MP_partner_id
  690.     bpl        .done
  691.     move.l        #.MPSERVER_eq_s,addrin+4    ;check environment for 'MPSERVER='
  692.     move.l        #.MPSERVER_name_p,addrin
  693.     sub_aes        #shel_envrn
  694.     move        #-1,MP_partner_id
  695.     tst        intout
  696.     beq.s        .not_env_partner
  697.     lea        .MPSERVER_name_s,a1
  698.     move.l        .MPSERVER_name_p,a0
  699.     moveq        #' ',d1
  700.     moveq        #8-1,d2
  701. .pad_8_loop:
  702.     move.b        (a0)+,(a1)+
  703.     bne.s        .next_char
  704.     subq        #1,a0
  705.     move.b        d1,-1(a1)
  706. .next_char:
  707.     dbra        d2,.pad_8_loop
  708.     move.l        #.MPSERVER_name_s,addrin
  709.     sub_aes        #appl_find
  710.     move        intout,MP_partner_id
  711.     bpl.s        .done
  712. .not_env_partner:
  713.     move.l        #.pad8_PAULA_s,addrin        ;check for app named "PAULA   "
  714.     sub_aes        #appl_find
  715.     move        intout,MP_partner_id
  716. .done:
  717.     movem.l        (sp)+,d1-d2/a0-a2
  718.     move        MP_partner_id,d0        ;d0 = app_id of MP partner or -1  (flagged)
  719.     rts
  720. ;
  721. .pad8_PAULA_s:
  722.     dc.b        'PAULA   ',NUL
  723. .pad8_MPSERVER_s:
  724.     dc.b        'MPSERVER',NUL
  725. .MPSERVER_eq_s:
  726.     dc.b        'MPSERVER=',NUL
  727. .MPSERVER_name_s:
  728.     ds.b        9
  729.     even
  730. .MPSERVER_name_p:
  731.     dc.l        0
  732. .ENDM    MP_set_partner_code
  733. ;
  734. ;------------------------------------
  735. ;
  736. .MACRO    MP_send.mode    MP_msg,arg1,arg2,arg3,arg4
  737.     _uniref        MP_send
  738. __MP_flag        =    __MP_&MP_msg
  739.     .IFB        MP_msg
  740.     .ERROR        MP_send used without any message code
  741.     .EXITM
  742.     .ENDIF
  743.     .IFNB        arg5
  744.     .ERROR        "MP_send used with more than 5 arguments"
  745.     .ERROR        "acceptable args = '&MP_msg,&arg1,&arg2,&arg3,&arg4'"
  746.     .ERROR        "incorrect arg = 'arg 5'"
  747.     .ENDIF
  748.     jsr        MP_preclear
  749.     move        #(MP_&MP_msg)&$FFFF,MP_message
  750.     .IFNB        arg1
  751.     __MP_arg.mode    0,arg1
  752.     .IFNB        arg2
  753.     __MP_arg.mode    1,arg2
  754.     .IFNB        arg3
  755.     __MP_arg.mode    2,arg3
  756.     .IFNB        arg4
  757.     __MP_arg.mode    3,arg4
  758.     .ENDIF        arg4
  759.     .ENDIF        arg3
  760.     .ENDIF        arg2
  761.     .ENDIF        arg1
  762.     jsr        code_MP_send
  763. .ENDM    MP_send
  764. ;
  765. .MACRO    code_MP_send
  766.     movem.l        d1-d2/a0-a2,-(sp)
  767.     move        MP_partner_id(pc),d0
  768.     bpl.s        .send_it_1
  769.     MP_set_partner    -1.w
  770.     bmi.s        .error
  771. .send_it_1:
  772.     move        MP_sender_id(pc),d0
  773.     bpl.s        .send_it_2
  774.     move        global+4,MP_sender_id
  775. .send_it_2:
  776.     lea        MP_message(pc),a0
  777.     clr        4(a0)
  778.     move        MP_sender_id(pc),2(a0)
  779.     GEM_AES        appl_write,MP_partner_id,#16,MP_message(pc)
  780.     moveq        #E_ACCDN,d0
  781.     tst        intout
  782.     beq.s        .exit
  783.     clr.l        d0
  784. .exit:
  785.     movem.l        (sp)+,d1-d2/a0-a2
  786.     tst        d0
  787.     rts
  788. ;
  789. .error:
  790.     moveq        #E_INVFN,d0
  791.     bra.s        .exit
  792. ;
  793. MP_preclear:
  794.     clr.l        MP_message
  795.     clr.l        MP_message+4
  796.     clr.l        MP_message+8
  797.     clr        MP_message+12
  798.     move        #$0204,message+14
  799.     rts
  800. ;
  801. MP_message:
  802.     ds.w        8
  803. MP_sender_id:
  804.     dc.w        -1
  805. MP_partner_id:
  806.     dc.w        -1
  807. .ENDM    code_MP_send
  808. ;
  809. ;------------------------------------
  810. ;
  811. .MACRO    __MP_arg.mode    argnum,argval
  812. __MP_type        set    (__MP_flag>>(8*argnum+4)) & 3
  813. __MP_pos        set    ((__MP_flag>>(8*argnum)) & 7)*2
  814.     .IF        (__MP_type==0)
  815.     move        argval,MP_message+__MP_pos
  816.     .EXITM
  817.     .ENDIF        type==0
  818.     .IF        (__MP_type==1)
  819.     move.l        argval,MP_message+__MP_pos
  820.     .EXITM
  821.     .ENDIF        type==1
  822.     .IF        (__MP_type==2)
  823.     .IF        '&.mode'=='.i'
  824.     move.l        argval,MP_message+__MP_pos
  825.     .ELSE
  826.     pea        argval
  827.     move.l        (sp)+,MP_message+__MP_pos
  828.     .ENDIF        mode
  829.     .ENDIF        type==2
  830. .ENDM    __MP_arg
  831. ;
  832. ;----------------------------------------------------------------------------
  833. ;End of file:    URAn_AV.SH
  834. ;----------------------------------------------------------------------------
  835.